/* GUI CONVERTED from gppibx02.i (converter v1.76) Thu Apr 25 18:59:01 2002 */
/* gppibx02.i - FIND PRICE LIST (ITEM AND CUSTOMER CODES PASSED IN)           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.11 $                                                          */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 8.5      LAST MODIFIED: 01/13/95   BY: afs *J042*                */
/* REVISION: 8.5      LAST MODIFIED: 02/10/96   BY: DAH *J0D5*                */
/* REVISION: 8.5      LAST MODIFIED: 04/02/96   BY: DAH *J0GT*                */
/* REVISION: 8.5      LAST MODIFIED: 07/05/96   BY: DAH *J0XR*                */
/* REVISION: 8.6E     LAST MODIFIED: 05/09/98   BY: *L00Y* Jeff Wootton       */
/* REVISION: 8.6E     LAST MODIFIED: 06/03/98   BY: *J2JJ* Niranjan R.        */
/* REVISION: 9.0      LAST MODIFIED: 11/24/98   BY: *M017* Luke Pokic         */
/* REVISION: 9.0      LAST MODIFIED: 12/22/98   BY: *M02W* Luke Pokic         */
/* REVISION: 9.0      LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 08/13/00   BY: *N0KS* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 03/12/01   BY: *L16Y* Nikita Joshi       */
/* $Revision: 1.11 $    BY: Jean Miller          DATE: 04/15/02  ECO: *P05H*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/* Revision: EB2 SP3 GUI   BY: Kaine Zhang      DATE: 11/06/03   *hk-s-026*  */

/*
   what I do is this:

   I include the find pi_mstr statements

   I/O definition:

   &cust_code  =  customer code to search for
   &part_code  =  item related code to search for

   This routine is _only_ included in gppibx01.i.

*/

if price_um <> "" then   /*if um is blank will do below*/
/*hk-s-026 add "and pi_user1 = ...  */
for each pi_mstr
   where pi_cs_type   = pics_type
     and pi_cs_code   = {&pics_code}
     and pi_part_type = part_type
     and pi_part_code = {&part_code}
     and pi_srch_type = search_type
     and pi_curr      = currency
     and pi_um        = price_um
     and (pi_start   <= price_date or pi_start = ?)
     and (pi_expire  >= price_date or pi_expire = ?)
     and pi_user1 = price_site
no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


   /* IGNORE PRICE LISTS CREATED BY APM */
   if pi_extrec = yes and pi_pig_code <> "" then next.

   if search_type = 2 then do:
      if pi_confg_disc then
         found_confg_disc = yes.
      if exclude_confg_disc and pi_confg_disc then
         next.
      else
      if select_confg_disc and not pi_confg_disc then
         next.
   end.

   l_confg_disc = pi_confg_disc.

   /* FILTER OUT PRICE-LISTS WHEN BEST LIST PRICE IS ZERO          */
   {gppibx2a.i  &pics_code = {&pics_code}
                &part_code = {&part_code}
                &price_um  = price_um}


   if available pi_mstr then do:
      {gprun.i ""gppibx03.p""
         "(pi_list_id,
           part_code,
           price_um,
           price_par,
           price_feat,
           price_opt,
           price_site,
           price_exch_rate,
           price_exch_rate2,
           output err_flag)"  }
/*GUI*/ if global-beam-me-up then undo, leave.

   end.

end.
/*GUI*/ if global-beam-me-up then undo, leave.


/* Also check for price lists with no UM */
if not match_pt_um then
/*hk-s-026 add "and pi_user1 = ...  */
for each pi_mstr
   where pi_cs_type   = pics_type
     and pi_cs_code   = {&pics_code}
     and pi_part_type = part_type
     and pi_part_code = {&part_code}
     and pi_srch_type = search_type
     and pi_curr      = currency
     and pi_um        = ""
     and (pi_start   <= price_date or pi_start = ?)
     and (pi_expire  >= price_date or pi_expire = ?)
     and pi_user1 = price_site
no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


   if search_type = 2 then do:
      if pi_confg_disc then
         found_confg_disc = yes.
      if exclude_confg_disc and pi_confg_disc then
         next.
      else
      if select_confg_disc and not pi_confg_disc then
         next.
   end.

   l_confg_disc = pi_confg_disc.

   /* FILTER OUT PRICE-LISTS WHEN BEST LIST PRICE IS ZERO */
   {gppibx2a.i  &pics_code = {&pics_code}
                &part_code = {&part_code}
                &price_um  = """"}

   if available pi_mstr then do:
      {gprun.i ""gppibx03.p""
         "(pi_list_id,
           part_code,
           price_um,
           price_par,
           price_feat,
           price_opt,
           price_site,
           price_exch_rate,
           price_exch_rate2,
           output err_flag)"  }
/*GUI*/ if global-beam-me-up then undo, leave.

   end.

end.
/*GUI*/ if global-beam-me-up then undo, leave.

